//star
$(document).ready(function() {

	var stepW = 24;
	var description = new Array("1", "2", "3", "4", "5");
	var stars = $("#star > li");
	var descriptionTemp;
	$("#showb").css("width", 0);
	stars.each(function(i) {
		$(stars[i]).click(function(e) {
			var n = i + 1;
			$("#showb").css({
				"width" : stepW * n
			});
			descriptionTemp = description[i];
			$(this).find('a').blur();
			return stopDefault(e);
			return descriptionTemp;
		});
	});
	stars.each(function(i) {
		$(stars[i]).hover(function() {
			$(".description").text(description[i]);
		}, function() {
			if (descriptionTemp != null)
				// $(".description").text("当前您的评价为："+descriptionTemp);
				// alert(descriptionTemp);
				return descriptionTemp;
			else
				return descriptionTemp;
		});
	});

	$("#ti").click(function() {
        
		if (descriptionTemp == null) {
			alert("请评星");
			return false;
		} else if($("#beizhu").val()==""){
			alert("请填写评价内容");
			return false;
		}
		$.post(ctx + "/weixin/f/autoinn/xc/ping/add/pro", {
			"expenseid" : $("#storeid").val(),
			"content" :$("#beizhu").val(),
			"xing" : descriptionTemp
		}, function(data) {
			if (data) {
				alert(data.message);
				window.location.href=ctx+"/weixin/f/autoinn/xc/userpay/dinglist";
			}
		}, "json");
		return true;

	});

});
function stopDefault(e) {
	if (e && e.preventDefault)
		e.preventDefault();
	else
		window.event.returnValue = false;
	return false;
};

function delHtmlTag(str)
{
 	var str=str.replace(/<\/?[^>]*>/gim,"");//去掉所有的html标记	
	var result=str.replace(/(^\s+)|(\s+$)/g,"");//去掉前后空格
	return  result.replace(/\s/g,"");//去除中间空格
}
